﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace WorkingWithBinding {
    /// <summary>
    /// Lógica de interacción para MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window {
        public MainWindow() {
            InitializeComponent();
            BindingOperations.ClearBinding(t1, ContentProperty);
            double d = 350;
            DateTime date = DateTime.Now;


            t1.Text = d.ToString("C");
            t1.Text = date.ToString("s");
          
        }

        private void Button_Click(object sender, RoutedEventArgs e) {
            MessageBox.Show(t3.Width + "," + t3.Height);
            t3.Height = 50;
        }

        private void t2_Error(object sender, ValidationErrorEventArgs e) {
           
        
}

        
    
    }

    public class MVC : IMultiValueConverter {

        object IMultiValueConverter.Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture) {
            return values[0].ToString() + "," + values[1].ToString();
        }

        object[] IMultiValueConverter.ConvertBack(object value, Type[] targetTypes, object parameter, System.Globalization.CultureInfo culture) {
            Object[] objArr = new Object[2];
            objArr = value.ToString().Split(',');
            return objArr;
        }
    }

    public class ReglaVacio : ValidationRule {

        public override ValidationResult Validate(object value, System.Globalization.CultureInfo cultureInfo) {
              
          if(value.ToString() =="")
              return new ValidationResult(false,"No puede ser vacio");

          return new ValidationResult(true, "todo Bien ");
        
        }
    
    }


    public class miClase : System.ComponentModel.INotifyPropertyChanged {
        private int Numero;
        public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;
        
        public miClase() {
            Numero = 10;
        }
     
        public int MyProperty { 
            get { 
                return Numero; 
            }
            set {
                Numero = value;
                PropertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs("MyProperty"));
            } 
        }


       
    }
    
}
